package com.wct.genetic;

import java.io.Serializable;
import java.util.List;

/**
 * @author WEI
 * @date 2018/5/27 13:48
 */
public class TspSolution implements Comparable<TspSolution> ,Serializable {
    private int weight;
    private List<Integer> pathList;

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public List<Integer> getPathList() {
        return pathList;
    }

    public void setPathList(List<Integer> pathList) {
        this.pathList = pathList;
    }

    @Override
    public String toString() {
        return weight + pathList.toString();
    }

    @Override
    public int compareTo(TspSolution o) {
    	if (weight > o.getWeight()) {
    		return 1;
    	}
    	if (weight < o.getWeight()) {
    		return -1;
    	}
    	return 0;
    	
//      return Integer.compare(this.weight,o.getWeight());
    }
}
